package demo.ssh.web;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

import demo.ssh.model.User;
import demo.ssh.service.TestService;

@Results( { @Result(name = "success",type="dispatcher" ,location = "/result.jsp")}) 
@Controller
public class TestAction {
	@Resource
	@Qualifier("service")
	TestService myService;
	
	private static final long serialVersionUID = 1L;
	User user;
	String code;
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Action(value = "test")
	public String execute() {
		System.out.println(this.user);
		System.out.println(this.code);
		myService.servce();
		return "success";
	}

}
